﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    #region Using Statements

    using System;

    #endregion

    /// <summary>
    /// An embedded Java applet. See the APPLET element definition in HTML 4.01.
    /// 
    /// This element is deprecated in HTML 4.01.
    /// </summary>
    public class HTMLAppletElement : HTMLBlockBaseElement
    {
        #region Constructors

        internal HTMLAppletElement(Document owner)
            : base(owner, HTMLConstants.HTML_TAG_APPLET)
        {
        }

        #endregion

        #region DOM Level 2 HTML Compliance

        /// <summary>
        /// Alternate text for user agents not rendering the normal content
        /// of this element. See the alt attribute definition in HTML 4.01.
        /// 
        /// This attribute is deprecated in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string alt
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_ALT);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_ALT);
                else
                    setAttribute(HTMLConstants.HTML_ATT_ALT, value);
            }
        }

        /// <summary>
        /// Comma-separated archive list. See the archive attribute definition 
        /// in HTML 4.01. This attribute is deprecated in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string archive
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_ARCHIVE);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_ARCHIVE);
                else
                    setAttribute(HTMLConstants.HTML_ATT_ARCHIVE, value);
            }
        }

        /// <summary>
        /// Applet class file. See the code attribute definition in HTML 4.01. 
        /// 
        /// This attribute is deprecated in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string code
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_CODE);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_CODE);
                else
                    setAttribute(HTMLConstants.HTML_ATT_CODE, value);
            }
        }

        /// <summary>
        /// Optional base URI [IETF RFC 2396] for applet. See the codebase 
        /// attribute definition in HTML 4.01. This attribute is deprecated 
        /// in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string codeBase
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_CODEBASE);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_CODEBASE);
                else
                    setAttribute(HTMLConstants.HTML_ATT_CODEBASE, value);
            }
        }

        /// <summary>
        /// Override height. See the height attribute definition in HTML 4.01. 
        /// 
        /// This attribute is deprecated in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string height
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_HEIGHT);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_HEIGHT);
                else
                    setAttribute(HTMLConstants.HTML_ATT_HEIGHT, value);
            }
        }

        /// <summary>
        /// Horizontal space to the left and right of this image in pixels. 
        /// See the hspace attribute definition in HTML 4.01. This attribute 
        /// is deprecated in HTML 4.01. Note that the type of this attribute 
        /// was DOMString in DOM Level 1 HTML [DOM Level 1].
        /// </summary>
        [Obsolete]
        public int hspace
        {
            get
            {
                return getAttributeAsType<int>(HTMLConstants.HTML_ATT_HSPACE, 0);
            }
            set
            {
                setAttributeAsType<int>(HTMLConstants.HTML_ATT_HSPACE, value);
            }
        }

        /// <summary>
        /// The name of the element (for backwards compatibility).
        /// </summary>
        [Obsolete]
        public string name
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_NAME);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_NAME);
                else
                    setAttribute(HTMLConstants.HTML_ATT_NAME, value);
            }
        }

        /// <summary>
        /// Message to render while loading the object. See the standby 
        /// attribute definition in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string @object
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_OBJECT);
            }
            set
            {
                setAttribute(HTMLConstants.HTML_ATT_OBJECT, value);
            }
        }
        /// <summary>
        /// Vertical space above and below this image in pixels. See the 
        /// vspace attribute definition in HTML 4.01. This attribute is 
        /// deprecated in HTML 4.01. Note that the type of this attribute 
        /// was "DOMString" in DOM Level 1 HTML [DOM Level 1].
        /// </summary>
        [Obsolete]
        public int vspace
        {
            get
            {
                return getAttributeAsType<int>(HTMLConstants.HTML_ATT_VSPACE, 0);
            }
            set
            {
                setAttributeAsType<int>(HTMLConstants.HTML_ATT_VSPACE, value);
            }
        }

        /// <summary>
        /// Override width. See the width attribute definition in HTML 4.01.
        /// </summary>
        [Obsolete]
        public string width
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_WIDTH);
            }
            set
            {
                setAttribute(HTMLConstants.HTML_ATT_WIDTH, value);
            }
        }

        #endregion
    }
}
